//2009/08/17 18:37:51
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class GridGenerator
{
public:
    int generate(vector <int> row, vector <int> col)
    {
		int dy[11][11];
		for(int i=0; i<row.size(); i++) dy[0][i] = row[i];
		for(int i=0; i<col.size(); i++) dy[i][0] = col[i];
		for(int i=1; i<col.size(); i++)
		{
			for(int j=1; j<row.size(); j++)
			{
				dy[i][j] = dy[i-1][j-1] + dy[i-1][j] + dy[i][j-1];
			}
		}
		return dy[col.size() -1][row.size() -1];
    }
};
